package huahua.microservicesimpleconsumermovie.controller;

import huahua.microservicesimpleconsumermovie.entity.User;
import huahua.microservicesimpleconsumermovie.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: zhanghuadi
 * @date: 2018/5/4 0004
 * @description: User类控制接口
 * 说明：由于学习时间限制，Controller层直接调用Dao层方法
 */
@RestController
public class UserController {

    @Autowired
    private UserRepository userRepository;

    @GetMapping("/user/{id}")
    public User findById(@PathVariable("id") Long id){
        return userRepository.findOne(id);
    }
}
